package com.zcs.app.lucky.ui

import android.view.View
import cn.sxw.android.base.dialog.CustomDialogHelper
import cn.sxw.android.base.kt.BaseViewModel
import com.zcs.app.lucky.base.BaseLuckyActivity
import com.zcs.app.lucky.databinding.ActivityLuckyHomeBinding

class LuckyHomeActivity : BaseLuckyActivity<ActivityLuckyHomeBinding, BaseViewModel>() {
    override fun onReady() {

        binding.toolbar.tvToolbarTitle.text = "幸运大抽奖"
        // 首页禁止返回
        binding.toolbar.ivToolbarBack.visibility = View.GONE
    }

    override fun onInit() {
        initView()
        initData()
        initObserve()
    }

    override fun initObserve() {}

    override fun initData() {}

    override fun initView() {}

    override fun addOnClickListener() {
        binding.btnGroups.setOnClickListener {
            launchActivity(GroupListActivity::class.java)
        }
        binding.btnPrize.setOnClickListener {
            launchActivity(PrizeListActivity::class.java)
        }
        binding.btnCreate.setOnClickListener {
            launchActivity(CreateLuckyActivity::class.java)
        }
        binding.btnHistory.setOnClickListener {
            launchActivity(LuckyHistoryActivity::class.java)
        }
    }

    override fun onBackPressed() {
        CustomDialogHelper.showCustomConfirmDialog(
            this,
            "你确定要退出吗？",
            object : CustomDialogHelper.NativeDialogCallback {
                override fun onConfirm() {
                    killMyself()
                }

                override fun onCancel() {}
            })
    }
}